<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html {
            font-size: 50px;
        }
        div{
            width: 2rem;
            height: 2rem;
            background-color: red;
            font-size: 0.3rem;
        }
    </style>
</head>
<body>
    <div>你是个麻瓜</div>
    <script>
       (function(doc, win) {
            var width = doc.documentElement.clientWidth
            doc.documentElement.style.fontSize = width / 7.5 + 'px'

        }(document, window))
    </script>
</body>
</html>